package com.platform.system.service.impl;

import java.util.List;

import com.platform.common.annotation.DataScope;
import com.platform.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.platform.system.mapper.ProCategoryMapper;
import com.platform.system.domain.ProCategory;
import com.platform.system.service.IProCategoryService;

/**
 * 商品类别Service业务层处理
 *
 * @author platform
 * @date 2025-02-23
 */
@Service
public class ProCategoryServiceImpl implements IProCategoryService {
    @Autowired
    private ProCategoryMapper proCategoryMapper;

    /**
     * 查询商品类别
     *
     * @param id 商品类别主键
     * @return 商品类别
     */
    @Override
    public ProCategory selectProCategoryById(Long id) {
        return proCategoryMapper.selectProCategoryById(id);
    }

    /**
     * 查询商品类别列表
     *
     * @param proCategory 商品类别
     * @return 商品类别
     */
    @Override
    @DataScope(deptAlias = "d", userAlias = "u")
    public List<ProCategory> selectProCategoryList(ProCategory proCategory) {
        return proCategoryMapper.selectProCategoryList(proCategory);
    }

    /**
     * 查询商品类别列表
     *
     * @param proCategory 商品类别
     * @return 商品类别
     */
    @Override
    public List<ProCategory> selectProCategoryListAll(ProCategory proCategory) {
        return proCategoryMapper.selectProCategoryList(proCategory);
    }

    /**
     * 新增商品类别
     *
     * @param proCategory 商品类别
     * @return 结果
     */
    @Override
    public int insertProCategory(ProCategory proCategory) {
        proCategory.setCreateTime(DateUtils.getNowDate());
        return proCategoryMapper.insertProCategory(proCategory);
    }

    /**
     * 修改商品类别
     *
     * @param proCategory 商品类别
     * @return 结果
     */
    @Override
    public int updateProCategory(ProCategory proCategory) {
        proCategory.setUpdateTime(DateUtils.getNowDate());
        return proCategoryMapper.updateProCategory(proCategory);
    }

    /**
     * 批量删除商品类别
     *
     * @param ids 需要删除的商品类别主键
     * @return 结果
     */
    @Override
    public int deleteProCategoryByIds(Long[] ids) {
        return proCategoryMapper.deleteProCategoryByIds(ids);
    }

    /**
     * 删除商品类别信息
     *
     * @param id 商品类别主键
     * @return 结果
     */
    @Override
    public int deleteProCategoryById(Long id) {
        return proCategoryMapper.deleteProCategoryById(id);
    }
}
